package  com.wps.netConnection.rpc.event
{
	import com.wps.netConnection.rpc.RpcToken;
	
	import flash.events.Event;

	/**
	 * rpc事件
	 * @author zhuohongtao
	 */
	public class RpcEvent extends Event
	{
		public static const WOW_RPC_EVENT: String = "wowRpcEvent";

		public static const StatusCodeSucceed: int			= 0;
		public static const StatusCodeRequestFault: int		= -1;
		public static const StatusCodeSecurityError: int	= -2;
		public static const StatusCodeIOError: int			= -3;
		public static const StatusCodeAsyncError: int		= -4;
		public static const StatusCodeStatusError: int		= -5;

		private var _token: RpcToken;
		private var _result: int;
		private var _data: Object;

		/**
		 * 构造函数
		 * @param type
		 * @param result
		 * @param data
		 */
		public function RpcEvent(token: RpcToken, result: int, data: Object = null)
		{
			super(WOW_RPC_EVENT);
			_token = token;
			_result = result;
			_data = data;
		}

		/**
		 * clone
		 */
		override public function clone(): Event
		{
			return new RpcEvent(_token, _result, _data);
		}

		/**
		 * token，调用该事件的连接标识
		 */
		public function get token(): RpcToken
		{
			return _token;
		}

		/**
		 * 方法返回的状态
		 */
		public function get result(): int
		{
			return _result;
		}

		/**
		 * 方法返回的数据
		 */
		public function get data(): Object
		{
			return _data;
		}
	}
}
